// pages/approval/reward/detail/detail.js
//获取应用实例
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    backImg: app.globalData.iconImgUrl+"arrow-left.svg",
    StatusBar: app.globalData.StatusBar,
    CustomBar: app.globalData.CustomBar,
    backIcon: true,
    title: "审核详情",
    formeImg: [],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options.id)
    this.getDetail(options.id)
  },
  getDetail(id) {
    const that = this
    wx.request({
      url: app.globalData.baseUrl + 'challenge/challengeDetails.do',
      method: 'post',
      data: {
        id: id,
        userCode: wx.getStorageSync('userCode')
      },
      success(res) {
        // console.log('挑战信息', res)
        const details = res.data.details
        const imgArr = []
        let auditType
        
        // console.log('挑战信息12', details)
        if (details.IMG1 !== '' && details.IMG1 !== null ) {
          imgArr.push(details.img1)
        }
        if (details.IMG2 !== '' && details.IMG2 !== null) {
          imgArr.push(details.img2)
        }
        if (details.IMG3 !== '' && details.IMG3 !== null) {
          imgArr.push(details.img3)
        }

        that.setData({
          content: details.CONTENT,
          markName: details.PROJECT,
          mark: details.AWARD_NUM,
          markType: details.CHALLENGE_TYPE,
          teamNum: details.QUORUMS,
          formeImg: imgArr,
          auditType: auditType
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})